def Normal_Convertor():
    import nuke
    target = nuke.selectedNode()
    channels = target.channels()
    channelList = []
    layers = ""
    for i  in channels:
        channelList.append(i.split('.')[0])
    channelList = list(set(channelList))
    for layer in channelList:
        layers = layers + layer + " "

    CamList = ''
    for classes in ['Camera','Camera2']:
        for i in nuke.allNodes(classes):
            CamList = CamList + i['name'].getValue() + " "
            print(i['name'].getValue())
            print(CamList)

    pannel = nuke.Panel('Normal_Convertor')
    pannel.addEnumerationPulldown('Normal Layers: ',layers)
    pannel.addEnumerationPulldown('Camera: ',CamList)
    pannel.show()
    if pannel.value('Camera: '):
        Cam = pannel.value('Camera: ')
        selectedLayer = pannel.value('Normal Layers: ')
        
        shuffles = nuke.createNode('Shuffle',inpanel = False)
        Matrixs = nuke.createNode('ColorMatrix',inpanel = False)
        
        shuffles.setInput(0,target)
        shuffles['in'].setValue(selectedLayer)
        shuffles['in2'].setValue('rgba')
        shuffles['alpha'].setValue('alpha2')
        Matrixs.setInput(0,shuffles)
        
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.0".format(Cam),0)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.1".format(Cam),1)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.2".format(Cam),2)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.4".format(Cam),3)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.5".format(Cam),4)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.6".format(Cam),5)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.8".format(Cam),6)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.9".format(Cam),7)
        Matrixs['matrix'].setExpression("parent.{0}.world_matrix.10".format(Cam),8)
        Matrixs['invert'].setValue(True)
        removes = nuke.createNode('Remove',inpanel = False)
        removes.setInput(0,Matrixs)
        removes['operation'].setValue(1)
        removes['channels'].setValue('rgba')
    else:
        pass
